/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Logger;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.*;

/**
 *
 * @author Riso-Desktop
 */
public class Loggerclass {
    //TODO: pridať niekde do nastavení možnosť zmazať staré logy
    Logger logger = java.util.logging.Logger.getLogger("mojlog");
    FileHandler fh;
    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    Date date = new Date();
    
    public Loggerclass() {
        try {
            
            fh = new FileHandler("logy/Logy-" + dateFormat.format(date) + ".log", true);
            logger.addHandler(fh);
            logger.setLevel(Level.ALL);
            SimpleFormatter format = new SimpleFormatter();
            fh.setFormatter(format);

        } catch (Exception e) {
            Logger.getLogger("mojlog").log(Level.WARNING, e.toString(), e);
        }
    }
}
